/*
 * @(#)XfvhdlHeadFile.java        3.0                         2004/09/14
 *
 * This file is part of Xfuzzy 3.0, a design environment for fuzzy logic
 * based systems.
 *
 * (c) 2000 IMSE-CNM. The authors may be contacted by the email address:
 *                    xfuzzy-team@imse.cnm.es
 *
 * Xfuzzy is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Xfuzzy is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

package xfuzzy.xfvhdl;

import java.util.*;

/**
* Clase que genera una cabecera para los distintos ficheros VHDL que se 
* generan.
* @author Jos� Mar�a �vila Maireles, <b>e-mail</b>: josavimai@alum.us.es
* @version 3.0
*/
public class XfvhdlHeadFile {

   private String dirOut;
   private String fileOut;
   private String fileIn;
   private String so;
   private String vmachine;
   private String date;
   private String user;
   private String separator;
   private boolean init;

   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
   //			CONSTRUCTOR DE LA CLASE				       		    
   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
   public XfvhdlHeadFile(String dirO, String fileO, String fileI) {

      dirOut = dirO;
      fileOut = fileO;
      fileIn = fileI;
      Date now = new Date();
      date = now.toString();

      if (init != true) {
         try {
            so = System.getProperty("os.name", "not specified");
            so += " ver. ";
            so += System.getProperty("os.version", "not specified");
            vmachine = System.getProperty("java.version", "not specified");
            user = System.getProperty("user.name", "not specified");
            separator = System.getProperty("file.separator", "\\");
         } catch (Exception e) {
         }
         init = true;
      }
   }

   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
   //			  M�TO_DOS P�BLICOS DE LA CLASE				        
   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
   /**
   * M�todo que crea la cabecera para ficheros VHDL.
   * @return Devuelve la cabecera que ser� escrita en el fichero VHDL.
   */
   public String getHead() {

      String head = new String();

      head =
         "--\n"
            + "--  Automatically generated by Xfvhdl3\n"
            + "--\n"
            + "--  output:: "
            + dirOut
            + separator
            + fileOut
            + "\n"
            + "--  source:: "
            + fileIn
            + "\n"
            + "--  for "
            + user
            + ", "
            + date
            + "\n"
            + "--  in "
            + so
            + " with VM "
            + vmachine
            + "\n"
            + "--\n";

      return head;
   }

   /**
   * M�todo que crea la cabecera para ficheros Script.
   * @return Devuelve la cabecera que ser� escrita en el fichero de script.
   */
   public String getScriptHead() {

      String head = new String();

      head =
         "#\n"
            + "#  Automatically generated by Xfvhdl3\n"
            + "#\n"
            + "#  output:: "
            + dirOut
            + separator
            + fileOut
            + "\n"
            + "#  source:: "
            + fileIn
            + "\n"
            + "#  for "
            + user
            + ", "
            + date
            + "\n"
            + "#  in "
            + so
            + " with VM "
            + vmachine
            + "\n"
            + "#\n";

      return head;
   }
} // Fin de la clase
